<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Badge
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>
<?php if ($this->paginator->getTotalItemCount()): ?>
  
  <?php if ($this->display_style == 'narrow'): ?>
    <ul class="badges_quicklist">
      <?php foreach ($this->paginator as $badge): ?>
        <li>
          <?php if ($this->showphoto): ?>
            <div class="badge_photo">
              <?php echo $this->htmlLink($badge->getHref(), $this->itemPhoto($badge, 'thumb.icon'))?>
            </div>
          <?php endif;?>
            <div class="badge_title">
              <?php echo $badge->__toString()?>
            </div>
          <?php if ($this->showdetails): ?>
            <div class="badge_details">
              <?php $badge_members = $badge->membershipCount(); ?>
            	<?php echo $this->translate(array("%s member", "%s members", $badge_members), $this->locale()->toNumber($badge_members)); ?>
            </div>
          <?php endif;?>
        </li>
      <?php endforeach;?>
    </ul>
  <?php else: ?>
    <ul class="badges_showcase">
      <?php foreach ($this->paginator as $badge): ?>
        <li>
          <?php if ($this->showphoto): ?>
            <div class="badge_photo">
              <?php echo $this->htmlLink($badge->getHref(), $this->itemPhoto($badge, 'thumb.normal'),
              $badge->getDescription() ? array('class' => 'BadgeTip','title'=>$badge->getTitle(), 'rel'=>$badge->getDescription()) : array()
              )?>
            </div>
          <?php endif;?>
            <div class="badge_title">
              <?php echo $badge->__toString()?>
            </div>
          <?php if ($this->showdetails): ?>
            <div class="badge_details">
              <?php $badge_members = $badge->membershipCount(); ?>
            	<?php echo $this->translate(array("%s member", "%s members", $badge_members), $this->locale()->toNumber($badge_members)); ?>
            </div>
          <?php endif;?>
        </li>
      <?php endforeach;?>
    </ul>
  <?php endif; ?>
  
  <script language="Javascript">
  
  en4.core.runonce.add(function(){
    
    var ListBadgeBadgeTip = new Tips($$('.BadgeTip'), {
      initialize:function(){
        this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
      },
      className: 'badge_bubble',
      showDelay: 400,
      hideDelay: 400
    });
    
  });
  </script>  
  
<?php else: ?>

  <?php // display nothing ?>
  
<?php endif; ?>